package com.wise.service.cms.content.decorate;

import cn.hutool.core.collection.CollectionUtil;
import com.wise.entities.content.Decorate;
import com.wise.framework.dao.SqlSelect;
import com.wise.framework.daomodel.DaoList;
import com.wise.summer.v1.cms.content.decorate.GetDecorate;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;

import java.util.List;

/**
 * @author hejiawei
 * @date 2020/9/27 13:14
 */
@Service
@SummerService
public class GetDecorateService implements SummerServiceBean<GetDecorate> {

    @Override
    public void sum(GetDecorate model) {
        SqlSelect sql = SqlSelect.selec("*")
                .fromClassName(Decorate.class)
                .eq(Decorate._module, model.getModule())
                .eq(Decorate._type, model.getType())
                .eqLang(Decorate._lang);

        List<Decorate> resourceList = DaoList.s(Decorate.class, sql);

        model.setSummerResult(CollectionUtil.getFirst(resourceList));

    }




}
